<?php
namespace app\admin\model\system;
use think\Model;

class Role extends Model
{
    protected $table='cp_auth_group';

    /**
     * @Notes:获取角色列表
     * @User: chenping
     * @email: 375129701@qq.com
     * @return $this[]|\think\Paginator
     */
    public function getPageRole($page=1,$limit=20)
    {
        return $this->paginate($limit);
    }

    /**
     * @Notes:创建角色
     * @User: chenping
     * @email: 375129701@qq.com
     * @param $data
     * @return static
     */
    public function createRole($data)
    {
        return $this->create($data);
    }

    /**
     * @Notes:编辑角色
     * @User: chenping
     * @email: 375129701@qq.com
     * @param $data
     * @return static
     */
    public function updateRole($data)
    {
        return $this->update($data);
    }

    /**
     * @Notes:编辑角色
     * @User: chenping
     * @email: 375129701@qq.com
     * @param $data
     * @return static
     */
    public function findRole($data)
    {
        return $this->find($data);
    }

    /**
     * @Notes:编辑角色
     * @User: chenping
     * @email: 375129701@qq.com
     * @param $data
     * @return static
     */
    public function deleteRole($id)
    {
        return $this->where("id","in",$id)->delete();
    }


    /**
     * @Notes:获取全部角色列表
     * @User: chenping
     * @email: 375129701@qq.com
     * @return array|\PDOStatement|string|\think\Collection
     */
    public function selectRole()
    {
        return $this->select();
    }

}